|
|
|
|
|
|
|
Calling the Report from within Visual Basic 5 |
|
|
|
|
|
|
|
|
When you have developed and saved your report definition using Crystal Reports Pro, you are ready to modify your Visual Basic 5 program to run the report from within your Visual Basic 5 application. Throughout the rest of this day, you'll be modifying the data entry form you built on Day 5, ''Input Validation." If you haven't done so yet, start Visual Basic 5 and load the CompanyMaster data entry program you created on Day 5. |
|
|
|
|
|
|
|
|
The Crystal Reports Pro Control |
|
|
|
|
|
|
|
|
It is very easy to run reports defined using Crystal Reports Pro from Visual Basic 5. Crystal Reports Pro for Visual Basic 5 ships with a special control (the Crystal Reports Pro Control) that can be added to any Visual Basic 5 form. Once you drop the control on your form, you only need to set a few properties to get a report printout from your program. The control has several properties that you can alter when setting up or running a report. |
|
|
|
|
|
|
|
|
First, place the Crystal Reports Pro Control onto the CompanyMaster data entry form. It doesn't matter where you place the control because it's invisible at runtime. Once you have placed the control on the form, set the ReportFileName property to C:\TYSDBVB5\SOURCE\ CHAP06\COMAST1\COMAST1.RPT and the WindowTitle property to Company Master Report. Leave CrystalReport1 as the default name for the control. Next, add a command button to the form. Refer to Figure 6.21 for placement and sizing. |
|
|
|
|
|
|
|
|
Figure 6.21.
Adding the Print command button. |
|
|
|
|
|